﻿using Microsoft.EntityFrameworkCore;
using xzz.webapi.Models.Domain;

namespace xzz.webapi.Data
{
    public class MYDbContext : DbContext
    {
        public MYDbContext(DbContextOptions dbContextOptions) : base(dbContextOptions)
        {
        }

        public DbSet<Difficulty> Difficultys { get; set; }
        public DbSet<Walk> Walks { get; set; }
        public DbSet<Region> Regions { get; set; }

        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            base.OnModelCreating(modelBuilder);
            //seed data to table
            var Difficulty = new List<Difficulty>()
            {
                new Difficulty()
                {
                    Id=Guid.Parse("649ACDBA-AFE4-4F78-8203-08DC34E7C312"),
                    Name="简单"
                },
                new Difficulty()
                {
                    Id=Guid.Parse("619ACDBA-AFE4-4F78-8203-08DC34E7C312"),
                    Name="适中"
                },
                new Difficulty()
                {
                    Id=Guid.Parse("611ACDBA-AFE4-4F78-8203-08DC34E7C312"),
                    Name="困难"
                }
            };
            modelBuilder.Entity<Difficulty>().HasData(Difficulty);
        }
    }
}
